//前端初始化数据结构（某些值可以为空:23~28）；
//从后台提取数据后，再赋值给前端存储的数据:31~33;
//前端存储数据结构，便于识别和检测；
import React from 'react';
import LayoutTableHeader from './layout_table_header';
import LayoutTableBody from './layout_table_body';

import { injectIntl } from 'react-intl';
class LayoutPanelCenter extends React.Component{
    render(){
        const { messages } = this.props.intl;

        const tableHeaders = [{
            text: messages.txt_item_roleName,
            className:'name-role'
        },{
            text: messages.txt_item_roleExpression,
            className:'description-role'
        }];

        const tableBodyRows = [];
        const tableBodyCells = [{
            text: "",
            className:"name-role"
        },{
            text: "",
            className:"description-role"
        }];
        if (this.props.rolelist.list) {
            this.props.rolelist.list.map((row, index) => {
                tableBodyCells[0].text = row.name;
                tableBodyCells[1].text = row.description;
                tableBodyRows.push({
                    id: row.id ? row.id : index,
                    cells: tableBodyCells
                });
            });
        }

        return(
            <div className="panel-body">
                <LayoutTableHeader
                    tableHeaders={tableHeaders}
                />
                <LayoutTableBody
                    tableBodyRows={tableBodyRows}
                    tableBodyEndTip = {messages.txt_noMore}
                    handleClick1={this.props.handleClick1}
                    handleWheel={this.props.handleWheel}
                />
            </div>
        )
    }
}
export default injectIntl(LayoutPanelCenter)